import axios from '@/libs/api.request';

/**
 * 检验管理 相关接口
 */

// 检验管理合同段树结构
export const getContractTree = () => {
  return axios.request({
    url: '/pt/qa/list',
    method: 'post'
  });
};

// 施工合同段详情
export const getContractDetail = data => {
  return axios.request({
    url: '/pt/node/view',
    method: 'POST',
    data: data
  });
};

// 根据父节点查询所有子孙节点的 工序 及其 测量表
export const getNodeWorks = data => {
  return axios.request({
    url: '/pt/gx/list',
    method: 'POST',
    data: data
  });
};

// 父节点查询出可用工序
export const getNodeUseWorks = data => {
  return axios.request({
    url: '/pt/gx/search',
    method: 'POST',
    data: data
  });
};

// 选中工序用表
export const checkWorkForm = data => {
  return axios.request({
    url: '/pt/report/checked',
    method: 'POST',
    data: data
  });
};

// 取消选中工序用表
export const uncheckWorkForm = data => {
  return axios.request({
    url: '/pt/report/uncheck',
    method: 'POST',
    data: data
  });
};

// 批量保存工序
export const saveWorks = data => {
  return axios.request({
    url: '/pt/add_gx',
    method: 'POST',
    data: data
  });
};

// 删除工序
export const delWork = data => {
  return axios.request({
    url: '/pt/delete',
    method: 'POST',
    data: data
  });
};

// 修改工序名称
export const renameWork = data => {
  return axios.request({
    url: '/pt/editname',
    method: 'POST',
    data: data
  });
};

// 获取施工检验表
export const getSgjcList = data => {
  return axios.request({
    url: '/pt/report/sgjc',
    method: 'POST',
    data: data
  });
};

// 获取监理检验表
export const getJljcList = data => {
  return axios.request({
    url: '/pt/report/jljc',
    method: 'POST',
    data: data
  });
};

// 编辑跳转报表拼接页面(表头信息)
export const editTableList = data => {
  return axios.request({
    url: '/pt/report/head',
    method: 'POST',
    data: data
  });
};

// 编辑跳转报表拼接页面(表尾信息)
export const editTablefooter = data => {
  return axios.request({
    url: '/dict/approvalInfo',
    method: 'POST',
    data: data
  });
};
// 监理测量表
export const editJLceliang = data => {
  return axios.request({
    url: '/pt/report/jl_sg_cl_head',
    method: 'POST',
    data: data
  });
  // 查看跳转报表表地址
};

export const tableURL = data => {
  return axios.request({
    url: '/pt/report/jl_sg_pd_head',
    method: 'POST',
    data: data
  });
};
// 检查表审批意见查询
export const getCheckListComment = (data, catalog) => {
  return axios.request({
    url: `/checklistComment/listByCatalog/${catalog}`,
    method: 'POST',
    data: data
  });
};
// 检查表审批意见提交
export const saveCheckComment = data => {
  return axios.request({
    url: `/pt/report/checklist/comment`,
    method: 'POST',
    data: data
  });
};
